name_list = ['1', '2', 666, True, 3.114, [12345, '秦宇翔']]
print(name_list)
print(type(name_list))
name = ['Rose', 'Tom', 'Lily']
print(name[0])
print(name[1])
print(name[2])
print(name[-1])
print(name[-2])
print(name[-3])
print(name_list[5][0])
print(name_list[5][1])
num = name.index('Tom')
print(num)
print(name)
name.insert(2, '666')
print(name)
name.append("你在狗叫什么？")
print(name)
name.extend(name_list)
print(name)
name_list = ['1', '2', 666, True, 3.114, [12345, '秦宇翔']]
del name_list[5]
print(name_list)
name_list = ['1', '2', 666, True, 3.114, '1', [12345, '秦宇翔']]
name_list.pop(5)
print(name_list)
name_list.remove('1')
print(name_list)
name_list.clear()
print(name_list)
luck = [1, 2, 3, 3, 3, 3, 3, 4, 5]
print(luck.count(3))
c = len(luck)
print(f"luck中的元素个数是{c}")
abc = [21, 25, 21, 3, 22, 20]
abc.append(31)
print(abc)
ab = [29, 33, 30]
abc.extend(ab)
print(abc)
print(abc[0])
print(abc[-1])
index1 = abc.index(31)
print(index1)
mn = ['你好', '我好', '他好', '大家好']
index = 0
while index < len(mn):
    index1 = mn[index]
    print(index1)
    index += 1
for x in mn:
    print(f"列表中的元素有：{x}")

list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list2 = []
list3 = []
for a in list1:
    if a % 2 == 0:
        list2.append(a)
print(f"通过for循环从列表{list1}中取出偶数，组成新列表:{list2}")

b = 0
while b < len(list1):
    if list1[b] % 2 == 0:
        list3.append(b)
    b += 1
print(f"通过while循环从列表{list1}中取出偶数，组成新列表:{list2}")

#  元组
# 元组
a1 = (123, 'hello', bool, True)
b1 = ((1, 2, 3), (4, 5, 6))
c1 = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
print(c1.index(4))
print(c1.count(3))
print(len(c1))
x = 0
while x < len(c1):
    index = c1[x]
    print(f"元组的元素有:{index}")
    x += 1
for d in c1:
    print(f"元组二中的元素有：{d}")
t1 = (1, 2, ['itheima', 'itcast'])
t1[2][0] = "黑马程序员"
print(t1)
# 元组练习案例
name2 = ('周杰伦', 11, ['football', 'music'])
print(name2.index(11))
print(name2[0])
name2[2].append('coding')
name2[2].pop(0)
print(name2)
